from playwright.sync_api import Playwright,expect,Page,sync_playwright
from faker import Faker
from random import randint
with sync_playwright() as p:
    browser = p.chromium.launch(headless=False,args=['--start-maximized'])
    context = browser.new_context(no_viewport=True)
    page = context.new_page()
    page.goto('http://4399.com')
    page.locator('.logo').click()

    # iframe = page.frame_locator('#popup_login_frame')
    # iframe.locator('#username').fill('123456')
    page.once('dialog',lambda alert_yes:alert_yes.accept())

    page.pause()
    page.close()

# fake = Faker('zh_CN')
# print(fake.qq)
# print(fake.password(8))
# print(fake.user_name())
# print(fake.credit_card_number())
# print(fake.user_name(),fake.name(),fake.credit_card_number())